<script>
	export default {
		data() {
			return {
				envParam:{
					//开发本地
					develop:{
						baseURL1:'http://127.0.0.1:8080/app',
						baseURL:'https://saiba.shouding711.com/app',
					},
					//体验版
					trial:{
						baseURL:'https://saiba.shouding711.com/app',
					},
					//正式版
					release:{
						baseURL:'https://saiba.shouding711.com/app',
					},
				}
			}
		},
		// 全局变量
		globalData: {
			envParam:{
				baseURL:'',
			},
		    miniProgram: {
		      appId: '',
		      envVersion: '',
		      version: ''
		    },
			authorizationBar: ''
		},
		onLaunch: function() {
			this.init()
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			async init() {
				await this.setBaseInfo()
			},
			setBaseInfo() {
				self = this
				
				return new Promise((resolve) => {
					console.log("--setBaseInfo--")
					uni.getStorage({
						key: 'authorizationBar',
						success: function (res) {
							//全局token
							self.globalData.authorizationBar = res.data
						},
						fail: (err) => {
							console.log("----fail")
							console.log(err)
						}
					})
					// // 设置全局参数
					const res = uni.getAccountInfoSync()
					//环境参数
					this.globalData.miniProgram = res.miniProgram
					//链接参数
					this.globalData.envParam = this.envParam[res.miniProgram.envVersion]
				})
			}
		}
		
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
	view{
		box-sizing:border-box;
	}
	.u-border-top {
		box-shadow: 0px -3px 6px 0px rgba(0,0,0,0.1);
	}	
	.u-tabbar__content__item-wrapper {
		margin-bottom: 30px;
	}
	body {
		background: #F5F5F5;
	}
</style>
